import '@/free/formatQuery' as formatQuery
import request

// 构造查询条件
var queryList = formatQuery('${tableName}', request.get().getParameterMap());

var sql = """
select * from ${tableName}
where 1 = 1
<foreach item='item' index='index' collection='queryList'>
    <if test="item.compare != 'in'">
        and ${item.code} ${item.compare} #{item.value}
    </if>
    <if test="item.compare == 'in'">
        and ${item.code} in
        <foreach item='val' collection='item.value'
            open="(" separator="," close=")">
            #{val}
        </foreach>
    </if>

</foreach>
"""
return db.page(sql);